﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rocket.Data;
using AutoMapper;
using Rocket.Windows.Framework;
using Rocket.Bll.Models;
using Rocket.Core;

namespace Rocket.Bll
{
    public class HandlerQuestion : BaseHandler<QuestionView, Question>
    {
        public HandlerQuestion()
            : base(RocketRepository<Question>.Instance)
        { }

        public override void ForwardMap(IMappingExpression<QuestionView, Question> mappingExpression)
        {
            mappingExpression
                 .ForMember(dest => dest.QuestionId, opt => opt.MapFrom(src => src.Id));
        }

        public override void BackwardMap(IMappingExpression<Question, QuestionView> mappingExpression)
        {
            mappingExpression
                .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QuestionId)); 
        }

        protected override Type LogPrefix
        {
            get { return GetType(); }
        }
    }
}
